# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2024-2025, GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with OpenQuake. If not, see <http://www.gnu.org/licenses/>.

"""
Created on Tue May 14 2024
Authors: savvinos.aristeidou@iusspavia.it

Module exports :class:`AristeidouEtAl2023`
               :class:`AristeidouEtAl2023RotD100`
"""

import numpy as np

from openquake.hazardlib.gsim.base import GMPE, CoeffsTable
from openquake.hazardlib import const
from openquake.hazardlib.imt import SDi
from openquake.hazardlib.gsim.campbell_bozorgnia_2014 import _get_z2pt5_ref


CONSTS = {
    "available_strength_ratios": np.array([1.5, 2, 3, 4, 6]),
    "mr": 6,
    "rh1": 15,
    "rh2": 150,
}


def _get_style_of_faulting(rake):
    """
    Get fault type dummy variables
    Fault type (Strike-slip, Normal, Reverse, Reverse-Oblique, Normal-oblique)
    is derived from rake angle.
                        SOF encoding    Rake Angles
    _______________________________________________________
    Strike-slip     |    0            | -180 < rake < -150
                    |                 | -30 < rake < 30
                    |                 | 150 < rake < 180
                    |                 |
    Normal          |    1            | -120 < rake < -60
                    |                 |
    Reverse         |    2            | 60 < rake < 120
                    |                 |
    Reverse-Oblique |    3            | 30 < rake < 60
                    |                 | 120 < rake < 150
                    |                 |
    Normal-oblique  |    4            | -150 < rake < -120
                    |                 | -60 < rake < -30
                    |                 |
    Note that the 'Unspecified' case is not considered here as
    rake is always given.
    """
    sof = np.full_like(rake, 0)

    sof[((rake >= -180) & (rake <= -150)) | ((rake > -30) &
        (rake <= 30)) | ((rake > 150) & (rake <= 180))] = 0

    sof[(rake > -120) & (rake <= -60)] = 1

    sof[(rake > 60) & (rake <= 120)] = 2

    sof[((rake > 30) & (rake <= 60)) | ((rake > 120) &
        (rake <= 150))] = 3

    sof[((rake > -150) & (rake <= -120)) | ((rake > -60) &
                                            (rake <= -30))] = 4

    return sof


def check_bounds(array, value):
    """
    Checks whether a value is smaller than the minimum number inside the array
    or bigger than the maximum number inside the array.
    Returns True if it is inside bounds
    """
    min_val = min(array)
    max_val = max(array)
    return not ((value < min_val) or (value > max_val))


def _get_magnitude_term(C, ctx):
    """
    Returns the magnitude scaling term defined in equation (4), p. 1610
    """
    f_m = C["b1"] * (ctx.mag - CONSTS["mr"]) + C["b2"] \
        * (ctx.mag - CONSTS["mr"]) ** 2
    return f_m


def _get_distance_term(C, ctx):
    """
    Returns the distance scaling term given by equation (5), p. 1611
    """
    r = np.sqrt(ctx.rrup ** 2 + C["c3"] ** 2)
    f_d = np.zeros(ctx.sids.shape)
    f_d[(r <= CONSTS["rh1"])] = (
        (C["c11"] + C["c21"] * (ctx.mag - CONSTS["mr"]))
        * np.log(r / CONSTS["rh2"]))[(r <= CONSTS["rh1"])]
    f_d[(r > CONSTS["rh1"]) & (r <= CONSTS["rh2"])] = (
        (C["c12"] + C["c22"] * (ctx.mag - CONSTS["mr"]))
        * np.log(r / CONSTS["rh2"]))[(r > CONSTS["rh1"]) & (r <= CONSTS["rh2"])]
    f_d[(r > CONSTS["rh2"])] = (
        (C["c13"] + C["c23"] * (ctx.mag - CONSTS["mr"]))
        * np.log(r / CONSTS["rh2"]))[(r > CONSTS["rh2"])]
    return f_d


def _get_style_of_faulting_term(C, ctx, mechanism):
    """
    Returns the style-of-faulting scaling term defined in equation (7), p. 1611
    """
    fn = np.ones(ctx.sids.shape) * ((mechanism == 1) | (mechanism == 4))
    ft = np.ones(ctx.sids.shape) * ((mechanism == 2) | (mechanism == 3))
    f_sof = C["f1"] * fn + C["f2"] * ft
    return f_sof


def _get_site_amplification_term(C, ctx):
    """
    Returns the site amplification term defined in equation (8), p. 1611
    """
    vs30 = ctx.vs30
    f_s = np.zeros(ctx.sids.shape)
    f_s[vs30 < 400] = (C["s1"] * np.log(vs30))[vs30 < 400]
    f_s[(vs30 >= 400) & (vs30 < 650)] = (
        C["s2"] * np.log(vs30))[(vs30 >= 400) & (vs30 < 650)]
    f_s[(vs30 >= 650) & (vs30 < 1000)] = (
        C["s3"] * np.log(vs30))[(vs30 >= 650) & (vs30 < 1000)]
    f_s[vs30 >= 1000] = (C["s4"] * np.log(vs30))[vs30 >= 1000]
    return f_s


def _get_basin_term(C, ctx, region=None):
    """
    Returns the basin response term defined in equation (9), p. 1611
    """
    z2pt5 = ctx.z2pt5.copy()
    # Use non-Japan CB14 vs30 to z2pt5 relationship for none-measured values
    mask = z2pt5 == -999
    z2pt5[mask] = _get_z2pt5_ref(False, ctx.vs30[mask])
    f_basin = np.zeros(ctx.sids.shape)
    f_basin[(z2pt5 <= 1)] = (C["d1"] * (z2pt5 - 1))[z2pt5 <= 1]
    f_basin[(z2pt5 > 1) & (z2pt5 <= 3)] = 0
    f_basin[z2pt5 > 3] = (
        C["d2"] * (1 - np.exp(-0.25*(z2pt5 - 3))))[z2pt5 > 3]
    return f_basin


def _get_strength_ratio_interpolation(coeffs, imt, hor_comp_def):
    """
    Returns the interpolated coefficients array for the intermediate
    strength ratio
    """
    prev_available_r = max(
        v for v in CONSTS["available_strength_ratios"]
        if v <= imt.strength_ratio)
    next_available_r = min(
        v for v in CONSTS["available_strength_ratios"]
        if v > imt.strength_ratio)
    prev_array = np.array(coeffs[
        f"R={prev_available_r:g}, {hor_comp_def}"][
            SDi(imt.period, prev_available_r)].tolist())
    next_array = np.array(coeffs[
        f"R={next_available_r:g}, {hor_comp_def}"][
            SDi(imt.period, next_available_r)].tolist())
    # Calculate the logarithmic interpolation factor
    interpolation_factor = \
        (np.log(imt.strength_ratio) - np.log(prev_available_r)) \
        / (np.log(next_available_r) - np.log(prev_available_r))

    # Perform linear interpolation
    interpolated_array = prev_array + \
        (next_array - prev_array) * interpolation_factor
    return interpolated_array


class AristeidouEtAl2023(GMPE):
    """
    Implements a ground motion model developed by Savvinos Aristeidou,
    Karim Tarbali, and Gerard J. O'Reilly, published as "A ground motion
    model for orientation-independent inelastic spectral displacements
    from shallow crustal earthquakes" (2023, Earthquake Spectra, Volume
    39, Number 3, pages 1601 - 1624).
    """
    #: Supported tectonic region type is active shallow crust
    DEFINED_FOR_TECTONIC_REGION_TYPE = const.TRT.ACTIVE_SHALLOW_CRUST

    #: Supported intensity measure types is inelastic spectral
    #: acceleration
    DEFINED_FOR_INTENSITY_MEASURE_TYPES = {SDi}

    #: Supported intensity measure components are orientation-
    #: independent median horizontal
    DEFINED_FOR_INTENSITY_MEASURE_COMPONENT = const.IMC.RotD50

    #: Supported standard deviation types are inter-event, intra-event
    #: and total
    DEFINED_FOR_STANDARD_DEVIATION_TYPES = {
        const.StdDev.TOTAL, const.StdDev.INTER_EVENT, const.StdDev.INTRA_EVENT}

    #: Required site parameters are Vs30, and depth (km) to the 2.5 km/s
    #: shear wave velocity layer (z2pt5)
    REQUIRES_SITES_PARAMETERS = {'vs30', 'z2pt5'}

    #: Required rupture parameters are magnitude, and rake
    REQUIRES_RUPTURE_PARAMETERS = {'mag', 'rake'}

    #: Required distance measures are Rrup
    REQUIRES_DISTANCES = {'rrup'}

    hor_comp_def = "RotD50"

    def compute(self, ctx: np.recarray, imts, mean, sig, tau, phi):
        """
        See :meth:`superclass method
        <.base.GroundShakingIntensityModel.compute>`
        for spec of input and result values.
        """
        for m, imt in enumerate(imts):
            strength_ratio_inside_bounds = check_bounds(
                CONSTS["available_strength_ratios"], imt.strength_ratio)
            if imt.strength_ratio in CONSTS["available_strength_ratios"]:
                C = self.COEFFS[
                    f"R={imt.strength_ratio:g}, {self.hor_comp_def}"][imt]
            elif imt.strength_ratio not in CONSTS["available_strength_ratios"] \
                    and strength_ratio_inside_bounds:
                interpolated_array = _get_strength_ratio_interpolation(
                    self.COEFFS, imt, self.hor_comp_def)
                coeff_names = self.COEFFS[
                    f"R=1.5, {self.hor_comp_def}"
                ][imt].dtype.names
                C = dict(zip(coeff_names, interpolated_array))
            else:
                raise ValueError(
                    f"Strength ratio of {imt.strength_ratio} out of bounds:"
                    f" {min(CONSTS['available_strength_ratios'])} - "
                    f"{max(CONSTS['available_strength_ratios'])}")
            mechanism = _get_style_of_faulting(ctx.rake)

            # Magnitude function:
            f_m = _get_magnitude_term(C, ctx)

            # Distance function:
            f_d = _get_distance_term(C, ctx)

            # Style-of-faulting function:
            f_sof = _get_style_of_faulting_term(C, ctx, mechanism)

            # Site amplification function:
            f_s = _get_site_amplification_term(C, ctx)

            # Basin-effects correction function:
            f_basin = _get_basin_term(C, ctx)

            # log of the functional form considered
            mean[m] = np.squeeze(C["a"] + f_m + f_d + f_sof + f_s + f_basin)
            sig[m] = C["σ"]
            tau[m] = C["τ"]
            phi[m] = C["φ"]

    COEFFS = {
        "R=1.5, RotD50": CoeffsTable(sa_damping=5, table="""\
    IMT                        a            b1             b2            c11           c21            c12           c22            c13            c23             f1             f2             s1             s2             s3             s4            d1            d2             c3             φ             τ             σ
    SDi(0.04,1.5)   -1.758849087   1.381262180   -0.140146031   -1.398100655   0.361526612   -1.191855753   0.279898229   -2.117781082   -0.130635956   -0.110768886    0.225237477   -0.760093882   -0.757635293   -0.764738799   -0.757807959   0.434248806   0.512515224   -14.85085583   0.798745211   0.265555928   0.841732656
    SDi(0.06,1.5)   -1.603799818   1.348551228   -0.145063886   -1.158580911   0.344574506   -1.130981115   0.244527474   -2.321292224    0.161704967   -0.051153370    0.243531959   -0.720881079   -0.720940544   -0.722592777   -0.717302743   0.422207803   0.503374323    9.570548758   0.792294290   0.260266733   0.833947849
    SDi(0.10,1.5)   -1.574686474   1.368524866   -0.182937648   -1.641341044   0.406546518   -1.478841573   0.383113100   -2.632188960    0.074015150   -0.120473877    0.132413494   -0.629679981   -0.630559198   -0.635699057   -0.625933797   0.199151554   0.478394983   -14.78851441   0.712990921   0.229036204   0.748874914
    SDi(0.20,1.5)   -1.140285168   1.302588586   -0.272226070   -1.464360324   0.293102467   -1.522684442   0.305656360   -3.003215688    0.100660926   -0.236006185    0.005214049   -0.461113726   -0.466010239   -0.492358962   -0.512894703   0.098010197   0.397326831    12.42063332   0.615802242   0.205523409   0.649193556
    SDi(0.30,1.5)   -0.031438895   1.237523220   -0.148234620   -1.402180632   0.272929812   -1.391779812   0.221740335   -2.867981670    0.051665138   -0.204981118    0.167353097   -0.524922201   -0.530311095   -0.555078108   -0.563010927   0.207990552   0.334699421    10.73169742   0.608802026   0.198545391   0.640359415
    SDi(0.50,1.5)    1.411521067   1.306762124   -0.190397169   -1.302645851   0.224830929   -1.279292060   0.185429778   -2.375068806   -0.047653455   -0.204596187    0.136774567   -0.618336662   -0.622706474   -0.640201151   -0.624228872   0.424243685   0.382268683   -10.04499085   0.612440807   0.204815454   0.645781010
    SDi(0.75,1.5)    2.556200545   1.413181380   -0.236128044   -1.220194145   0.211300956   -1.176226161   0.180845094   -2.055955453   -0.063852806   -0.286259001    0.040854373   -0.708783854   -0.709352716   -0.715606603   -0.686591400   0.593184504   0.317620201    8.698950058   0.621967142   0.248257990   0.669682876
    SDi(1.00,1.5)    2.974178276   1.496415852   -0.285067904   -1.134041626   0.174409811   -1.116058731   0.171593783   -1.880757195   -0.118671297   -0.287662804    0.074717695   -0.719813096   -0.726202156   -0.726508232   -0.687408595   0.699558221   0.406245401    7.552540994   0.626424028   0.221789485   0.664528132
    SDi(1.50,1.5)    3.413913510   1.583684476   -0.324385686   -1.021830173   0.112856487   -1.005633426   0.116729551   -1.519885379   -0.014434998   -0.246904534    0.104520919   -0.717524312   -0.728818218   -0.718707900   -0.687252652   0.844941176   0.396457276    6.454938294   0.626357803   0.223506379   0.665040750
    SDi(2.00,1.5)    3.647006004   1.683038675   -0.354886441   -0.992435334   0.087460079   -0.981644112   0.083034144   -1.332378913    0.051667444   -0.280003892    0.092896069   -0.722690155   -0.736509802   -0.719389394   -0.670094795   0.902655446   0.490155482    6.820444963   0.623536407   0.206688429   0.656900112
    SDi(3.00,1.5)    4.054609165   1.889546075   -0.429713632   -1.037466618   0.074905503   -1.033147473   0.061239070   -1.105494574   -0.015507275   -0.337484492    0.033000350   -0.760238842   -0.770163885   -0.746076057   -0.691706581   0.923741399   0.417828867    8.349350311   0.611820161   0.223146521   0.651243640
    SDi(4.00,1.5)    4.237981573   2.077832823   -0.439627726   -1.027176064   0.058419457   -1.079259311   0.098124872   -1.147095752    0.007074746   -0.421166679   -0.112579073   -0.769928210   -0.778685547   -0.746909213   -0.682370120   0.887790527   0.519053791    9.876059651   0.600012696   0.211932375   0.636341549
    SDi(5.00,1.5)    4.225517745   2.174180934   -0.433792674   -1.003636314   0.066002403   -1.053923323   0.105470598   -1.106498927   -0.004875363   -0.578062061   -0.168960060   -0.744394076   -0.752495502   -0.717696455   -0.647488306   0.869751099   0.544963930   -9.079453231   0.600423691   0.234705539   0.644666812
    """),
        "R=2, RotD50": CoeffsTable(sa_damping=5, table="""\
    IMT                        a            b1             b2            c11           c21            c12          c22             c13            c23             f1             f2             s1             s2             s3             s4            d1            d2             c3             φ             τ             σ
    SDi(0.04,2)     -1.161601188   1.305947649   -0.171136257   -1.126220540   0.257293139   -1.155225673   0.223525560   -2.299900574   -0.124574656   -0.237036007    0.195959978   -0.661664774   -0.664738127   -0.687319622   -0.689471131   0.406006194   0.486967237    9.748876882   0.700325954   0.250277287   0.743703679
    SDi(0.06,2)     -0.205215058   1.330746163   -0.127451079   -1.017740139   0.240851185   -1.010704350   0.203773129   -1.926477144   -0.057422687   -0.051251953    0.286174244   -0.769257203   -0.768713691   -0.783722659   -0.784497468   0.543695066   0.529157825    8.261251597   0.783080979   0.292813889   0.836035761
    SDi(0.10,2)     -0.163820415   1.365990680   -0.113253918   -1.103941369   0.321671124   -1.090185747   0.255889928   -2.011599664    0.033190618   -0.036480469    0.263705021   -0.730628424   -0.731582145   -0.737662785   -0.720530619   0.491874182   0.498188602    8.061370457   0.790046586   0.281534038   0.838710334
    SDi(0.20,2)     -0.155942704   1.364030090   -0.232648737   -1.718293468   0.180536230   -1.475075669   0.332723054   -2.424115090    0.094194964   -0.169600986    0.063441829   -0.598049393   -0.599840227   -0.616095719   -0.623345418   0.249720866   0.502539390   -14.99853764   0.637619763   0.227669498   0.677046794
    SDi(0.30,2)      0.500359282   1.301805750   -0.173343935   -1.685546582   0.200696657   -1.461807820   0.269322886   -2.485493503    0.051686632   -0.188445202    0.150563978   -0.604204609   -0.606421632   -0.623691688   -0.615914495   0.297108044   0.435350515   -14.99984050   0.598068083   0.201633985   0.631143165
    SDi(0.50,2)      1.615670551   1.329014935   -0.226056799   -1.273753571   0.231200278   -1.253068618   0.194714594   -2.284205271    0.005986116   -0.262672699    0.059256751   -0.640149903   -0.644689093   -0.657699720   -0.637524846   0.469086042   0.355121017   -9.534212489   0.593588905   0.215400036   0.631462559
    SDi(0.75,2)      2.528622600   1.428449359   -0.241064333   -1.199036119   0.206379826   -1.164249548   0.175177290   -1.991629972   -0.032052816   -0.275580263    0.040298529   -0.704902569   -0.706743232   -0.711934809   -0.677405734   0.612913084   0.344393110    8.154463607   0.604444501   0.246929652   0.652937522
    SDi(1.00,2)      2.895577011   1.503559299   -0.285045465   -1.137939660   0.169346874   -1.114100229   0.167964955   -1.830413088   -0.046258749   -0.290615198    0.065575632   -0.707884732   -0.715721861   -0.715083001   -0.672980471   0.717402835   0.432017270    7.787718408   0.609055214   0.222688518   0.648489344
    SDi(1.50,2)      3.411184207   1.587365753   -0.315607830   -1.024855619   0.106920477   -1.010884518   0.117365039   -1.502284509    0.019251771   -0.266072729    0.096243535   -0.723239129   -0.733765797   -0.722747307   -0.687436080   0.843005488   0.421938537    6.599477642   0.613110615   0.219472357   0.651208678
    SDi(2.00,2)      3.651301537   1.676598386   -0.346155917   -0.992984015   0.082375967   -0.987555675   0.076190570   -1.327627850    0.071682297   -0.292961848    0.086897180   -0.729259983   -0.742203008   -0.724662111   -0.675011962   0.892028111   0.482021416    6.838351748   0.609401324   0.206477520   0.643430602
    SDi(3.00,2)      3.966392278   1.889865612   -0.415337221   -1.030959806   0.076928045   -1.029325957   0.069161303   -1.100806835    0.029070700   -0.346807353    0.031834222   -0.750606407   -0.760279284   -0.736748579   -0.685150998   0.906507259   0.423534691    8.215911736   0.597571118   0.216953575   0.635735869
    SDi(4.00,2)      4.156305898   2.069392981   -0.423983376   -1.031541923   0.067493720   -1.064424928   0.108449051   -1.125962891    0.014979388   -0.426098679   -0.085482339   -0.763831049   -0.771409589   -0.739844813   -0.678719580   0.864330762   0.510802186   -9.630688294   0.587031017   0.215758335   0.625425515
    SDi(5.00,2)      4.083450833   2.176724488   -0.445047396   -0.526177683   0.196549513   -1.142568024   0.096016193   -1.043174754    0.028286232   -0.599651663   -0.205865413   -0.726571398   -0.734717384   -0.701323118   -0.631501583   0.851920676   0.636365339   -14.99983765   0.588109208   0.228729382   0.631022639
    """),
        "R=3, RotD50": CoeffsTable(sa_damping=5, table="""\
    IMT                        a            b1             b2            c11           c21            c12           c22            c13            c23             f1             f2             s1             s2             s3             s4            d1            d2            c3             φ             τ             σ
    SDi(0.04,3)     -1.121047821   1.226042008   -0.169108204   -1.268441440   0.261301839   -1.301120027   0.227365693   -2.672738653   -0.037004291   -0.229260796    0.175030804   -0.564158722   -0.570829167   -0.603500481   -0.617698463   0.253308858   0.435027959   9.814472014   0.672616368   0.218753315   0.707294699
    SDi(0.06,3)      0.363125555   1.271065883   -0.175717455   -1.121054576   0.216232724   -1.104621938   0.186771874   -2.065027882   -0.137477738   -0.200949974    0.171519297   -0.720613186   -0.723431271   -0.751459918   -0.753645130   0.486694338   0.509246943   8.782551933   0.755968740   0.274319295   0.804201351
    SDi(0.10,3)      1.145137992   1.330643501   -0.104426984   -1.001210240   0.228938531   -0.977664848   0.181659423   -1.629083691   -0.089018334   -0.062616945    0.215189670   -0.809648535   -0.807815685   -0.818074269   -0.797082898   0.645194464   0.506199067   6.085498866   0.836099347   0.333547816   0.900175685
    SDi(0.20,3)      1.097773914   1.385645348   -0.165258723   -1.205287704   0.287531678   -1.185465371   0.270850768   -1.930512057    0.157869426   -0.078492416    0.242060162   -0.738537206   -0.739758716   -0.744378685   -0.718510998   0.486651886   0.445303656   8.299330094   0.723960431   0.276203096   0.774859249
    SDi(0.30,3)      1.343147575   1.364144069   -0.197581168   -1.256373795   0.256409170   -1.241362478   0.253393166   -2.119656921    0.142500176   -0.162350480    0.163049440   -0.696914355   -0.698112992   -0.704484433   -0.678904794   0.470161155   0.413802102   8.986648675   0.639352111   0.238931753   0.682539013
    SDi(0.50,3)      1.924532557   1.397846121   -0.238326054   -1.226804384   0.213557630   -1.204187809   0.209759956   -2.047888077    0.081376361   -0.251985002    0.057003983   -0.673876950   -0.678466578   -0.685221828   -0.647054289   0.563755776   0.388249618   8.781873478   0.596773863   0.240699403   0.643486787
    SDi(0.75,3)      2.536960767   1.464878579   -0.248297099   -1.163536265   0.177694547   -1.141005950   0.175777781   -1.869341772    0.015452605   -0.256036597    0.051867343   -0.697508906   -0.702094773   -0.703331022   -0.660200217   0.671009150   0.353752582   7.737689700   0.595063966   0.243759180   0.643054944
    SDi(1.00,3)      2.882907557   1.533063877   -0.288987135   -1.129032632   0.159321346   -1.102524546   0.157916805   -1.690565462    0.045305742   -0.305840876    0.038751973   -0.700186326   -0.709655158   -0.705633098   -0.663825702   0.740466514   0.456684699   7.788155802   0.596578991   0.214425988   0.633944001
    SDi(1.50,3)      3.455261515   1.646909009   -0.339706277   -1.034132828   0.104115529   -1.023269746   0.113659154   -1.509195586    0.122602460   -0.349591335   -0.008014411   -0.728003109   -0.737067670   -0.724029483   -0.678031209   0.863960164   0.428981406   6.838823370   0.601239058   0.215607941   0.638729355
    SDi(2.00,3)      3.660032865   1.698404304   -0.333718040   -0.994681490   0.081041793   -0.990642597   0.079357640   -1.336124895    0.095210136   -0.317759777    0.069705041   -0.734328059   -0.744812359   -0.725976347   -0.679388622   0.881744443   0.463265283   6.896465146   0.593879035   0.207233599   0.628997673
    SDi(3.00,3)      3.845520600   1.921136562   -0.397345242   -1.026731789   0.081742862   -1.014311977   0.084000135   -1.135161518    0.092001394   -0.360397840    0.011792960   -0.730761855   -0.741254933   -0.715109299   -0.663555449   0.861666919   0.426057457   8.091893124   0.587554364   0.218733872   0.626948672
    SDi(4.00,3)      4.049707138   2.076226892   -0.415940397   -1.004773335   0.085832059   -1.023219512   0.117682843   -1.110759137    0.064804687   -0.466739743   -0.084523798   -0.746658148   -0.752139669   -0.719771996   -0.660512762   0.826517193   0.490587158   8.141507650   0.578835826   0.221210627   0.619665277
    SDi(5.00,3)      3.907003589   2.151924460   -0.430013692   -0.986751446   0.059943466   -1.030235329   0.115055676   -1.105008448    0.109001849   -0.595467157   -0.154363325   -0.697965166   -0.705027217   -0.672932274   -0.602223668   0.826488404   0.615097807   8.959895138   0.570213226   0.230049374   0.614870586
    """),
        "R=4, RotD50": CoeffsTable(sa_damping=5, table="""\
    IMT                        a            b1             b2            c11           c21            c12           c22            c13            c23             f1             f2             s1             s2             s3             s4            d1            d2             c3             φ             τ             σ
    SDi(0.04,4)     -1.112158527   1.210747431   -0.190663896   -1.344226784   0.268681429   -1.373080488   0.238891226   -2.870563449    0.016022485   -0.232996315    0.132756403   -0.524157706   -0.531268260   -0.565736699   -0.582650915   0.190617148   0.420344221    10.53258818   0.671806235   0.209217761   0.703630364
    SDi(0.06,4)      0.464409387   1.223549463   -0.144835632   -1.196754523   0.210473578   -1.172770057   0.172803304   -2.182477817   -0.157287102   -0.197352934    0.236773894   -0.689971034   -0.693692191   -0.724616093   -0.728958334   0.431383249   0.494063705   -9.416592196   0.746775577   0.251406980   0.787958903
    SDi(0.10,4)      1.651313409   1.334143263   -0.109752022   -1.053841951   0.203227770   -0.992631757   0.170319125   -1.568576155   -0.151982692   -0.075908023    0.256878535   -0.829756047   -0.827940917   -0.840090824   -0.819597147   0.667162926   0.527855200    7.142439298   0.840897685   0.331528749   0.903891712
    SDi(0.20,4)      1.785689049   1.434758532   -0.143431971   -1.115707532   0.254688500   -1.108112318   0.280756364   -1.641936847    0.066434249   -0.072902615    0.255288268   -0.804681598   -0.806216972   -0.805683385   -0.761815924   0.603426827   0.450419956    6.620075259   0.774604992   0.311450857   0.834873961
    SDi(0.30,4)      1.862285367   1.418896965   -0.190634940   -1.181370279   0.235127560   -1.176676496   0.271181772   -1.842198756    0.149305468   -0.125937474    0.176058684   -0.750107364   -0.752363533   -0.752194754   -0.712190774   0.585116938   0.436508199    7.737934483   0.684011545   0.266480269   0.734086866
    SDi(0.50,4)      2.126194849   1.454679205   -0.248470288   -1.174757673   0.200660855   -1.166299798   0.221906777   -1.849511317    0.145181267   -0.255531581    0.051978775   -0.688281476   -0.693753291   -0.694858433   -0.649058069   0.647077686   0.406684024    7.738051465   0.617376611   0.262328912   0.670798284
    SDi(0.75,4)      2.625277043   1.490845018   -0.253439265   -1.130328209   0.162823978   -1.120737187   0.170966626   -1.750299102    0.085129102   -0.253602827    0.064895939   -0.702676795   -0.708858681   -0.706155582   -0.657459339   0.710460416   0.418845731    7.179800422   0.602562281   0.251214319   0.652832242
    SDi(1.00,4)      2.851827314   1.545772721   -0.281711603   -1.104067433   0.140277086   -1.082250532   0.144224699   -1.561987133    0.131750415   -0.291135699    0.079928506   -0.689304021   -0.699226883   -0.692301572   -0.648096459   0.758607057   0.494511648    7.552644808   0.599082258   0.212455421   0.635638937
    SDi(1.50,4)      3.444448295   1.624929724   -0.311256114   -1.025011521   0.095244547   -1.005784881   0.098356152   -1.429049471    0.160030266   -0.298506167    0.079506113   -0.729150842   -0.737682169   -0.723348527   -0.673580782   0.828599840   0.447292251    6.897395403   0.599200401   0.216138386   0.636990520
    SDi(2.00,4)      3.631338713   1.736343959   -0.327990607   -0.990889916   0.080481670   -0.988886664   0.083232341   -1.326497463    0.123730883   -0.321196961    0.047695239   -0.730316917   -0.739145327   -0.718908141   -0.670066718   0.840810986   0.483191512    6.765820950   0.593532692   0.213486828   0.630759608
    SDi(3.00,4)      3.813694329   1.980985852   -0.403302114   -1.023770824   0.093059645   -1.009538060   0.100235130   -1.146573091    0.123741997   -0.403343364   -0.062187186   -0.720825695   -0.729769659   -0.703347211   -0.654423636   0.823338550   0.446026895    7.737816198   0.586330468   0.226610812   0.628598344
    SDi(4.00,4)      3.891877162   2.096055083   -0.411513367   -1.005984506   0.088872010   -1.013218668   0.116001663   -1.086615597    0.115194071   -0.482124762   -0.075533044   -0.720575294   -0.725903129   -0.693620054   -0.635340264   0.808594634   0.502754630    8.204528434   0.575012567   0.227404951   0.618346556
    SDi(5.00,4)      3.794876570   2.171914279   -0.429636002   -0.985949523   0.060352589   -1.025650534   0.131118533   -1.086031048    0.162698562   -0.608535091   -0.182149528   -0.678715289   -0.684656131   -0.654029203   -0.586156938   0.799983062   0.658604999   -8.959863927   0.563677216   0.232236220   0.609643884
    """),
        "R=6, RotD50": CoeffsTable(sa_damping=5, table="""\
    IMT                        a            b1             b2            c11           c21            c12           c22            c13            c23             f1             f2             s1             s2             s3             s4            d1            d2             c3             φ             τ             σ
    SDi(0.04,6)     -1.098088322   1.221496883   -0.238636341   -1.409301310   0.261478924   -1.452287672   0.256888350   -3.029107828    0.061404583   -0.264578633    0.065187959   -0.482597677   -0.489808477   -0.527722324   -0.549114676   0.127687853   0.414503186    11.64081642   0.678945650   0.205109394   0.709251055
    SDi(0.06,6)      0.538247575   1.193628190   -0.150060574   -1.254035693   0.218379081   -1.224714953   0.161882219   -2.362137528   -0.118528488   -0.219869890    0.215368351   -0.648258350   -0.653291273   -0.685189297   -0.687282112   0.381303412   0.452393335   -9.534110762   0.737975678   0.230958042   0.773272086
    SDi(0.10,6)      2.077056780   1.317391548   -0.133181349   -1.115167424   0.191924409   -1.041129684   0.161214452   -1.601964512   -0.195497671   -0.190339879    0.151245127   -0.827306040   -0.826001925   -0.838757312   -0.817308434   0.686583324   0.515490300    7.803450663   0.831990580   0.322249193   0.892217948
    SDi(0.20,6)      2.537236466   1.502481523   -0.137545337   -1.058325290   0.236114559   -1.048235109   0.277481695   -1.386675146   -0.007776229   -0.122704148    0.228729555   -0.864034208   -0.866533638   -0.860915114   -0.808610545   0.718315414   0.481332136    5.281996784   0.812965546   0.336700512   0.879931937
    SDi(0.30,6)      2.397653057   1.504630322   -0.192318638   -1.112126260   0.219363040   -1.105515509   0.276265148   -1.507987923    0.141215011   -0.127891437    0.159120680   -0.787481936   -0.793093185   -0.785269060   -0.737024173   0.731010359   0.440822377    6.527794215   0.733181734   0.296580963   0.790895520
    SDi(0.50,6)      2.455815000   1.520933149   -0.243436589   -1.118894905   0.187075254   -1.119107820   0.216605373   -1.601526919    0.234022154   -0.229620155    0.065246820   -0.715255535   -0.722571417   -0.716048109   -0.663460389   0.752251922   0.409358173    6.780598314   0.653739510   0.284192722   0.712839989
    SDi(0.75,6)      2.812238715   1.543309501   -0.268181233   -1.104055680   0.131906920   -1.094641696   0.150193365   -1.528522274    0.165332450   -0.261325867    0.057638329   -0.715070508   -0.723082724   -0.713504804   -0.659527020   0.781911458   0.491151109    7.146029257   0.625339268   0.265048473   0.679190616
    SDi(1.00,6)      2.921628796   1.592939911   -0.283495613   -1.073130294   0.115580226   -1.063409385   0.125246271   -1.387616942    0.260957345   -0.303650372    0.057341032   -0.689077412   -0.699314065   -0.686411155   -0.639540985   0.787078941   0.518494619    7.088496234   0.614496668   0.224953076   0.654377599
    SDi(1.50,6)      3.383913284   1.689509487   -0.304513410   -1.017198497   0.091289356   -1.000978958   0.095007899   -1.368254314    0.225761021   -0.303045578    0.055422734   -0.715100481   -0.723941843   -0.707627124   -0.649599812   0.803712229   0.521883812    6.599929371   0.608309042   0.226390888   0.649070663
    SDi(2.00,6)      3.521185398   1.796723123   -0.317253938   -0.988074823   0.072681000   -0.979615617   0.086828425   -1.306862285    0.198471750   -0.341042837    0.025470633   -0.710279874   -0.718715655   -0.696244803   -0.640278828   0.776004032   0.538084717    6.475916722   0.602311222   0.225983986   0.643309856
    SDi(3.00,6)      3.692763523   2.052536185   -0.404142016   -1.023831318   0.095271382   -1.009186698   0.116127302   -1.115326995    0.173649585   -0.416968765   -0.092264698   -0.699249749   -0.708057318   -0.680003069   -0.630278879   0.781640587   0.461670885    7.624990768   0.582941606   0.234827394   0.628462267
    SDi(4.00,6)      3.653436765   2.132812898   -0.398551678   -1.014490313   0.102078556   -1.009585188   0.137766215   -1.042914709    0.147002649   -0.476916771   -0.081980857   -0.683348961   -0.689763024   -0.657275006   -0.602795611   0.768035229   0.508717113    8.091966505   0.566920011   0.241078820   0.616049751
    SDi(5.00,6)      3.552790400   2.250745163   -0.436353534   -0.995000174   0.079362374   -1.029460175   0.169025489   -1.064155964    0.225974707   -0.646949492   -0.246883684   -0.636825951   -0.643241205   -0.615085602   -0.554096429   0.761545928   0.675096531    8.959875079   0.559125372   0.244441068   0.610223416
    """),
    }


class AristeidouEtAl2023RotD100(AristeidouEtAl2023):
    """
    Implements the Aristeidou, Tarbali, and O'Reilly (2023) GMM for
    the RotD100 horizontal component definition
    """

    #: Supported intensity measure components are orientation-
    #: independent maximum horizontal
    DEFINED_FOR_INTENSITY_MEASURE_COMPONENT = const.IMC.RotD100

    hor_comp_def = "RotD100"

    COEFFS = {
        "R=1.5, RotD100": CoeffsTable(sa_damping=5, table="""\
    IMT                        a            b1             b2            c11           c21            c12           c22            c13            c23             f1             f2             s1             s2             s3             s4            d1            d2             c3             φ             τ             σ
    SDi(0.04,1.5)   -1.351111422   1.307219253   -0.139469557   -1.147938415   0.290601842   -1.165449312   0.264451688   -2.139283827   -0.166209815   -0.196499773    0.227608029   -0.656525058   -0.659422459   -0.678793702   -0.682383352   0.397436489   0.471029665    9.701920576   0.733811791   0.258094180   0.777876822
    SDi(0.06,1.5)   -0.673425494   1.388085210   -0.159440971   -1.092259522   0.300693428   -1.093935632   0.295111797   -2.017869321   -0.003919270   -0.188440131    0.134116838   -0.712425106   -0.713470711   -0.723111513   -0.717627189   0.539332693   0.549028905    8.380203715   0.811600918   0.282975529   0.859518005
    SDi(0.10,1.5)   -0.689424186   1.389646664   -0.169406397   -1.239848510   0.380927856   -1.242120832   0.331305826   -2.270214373    0.101598198   -0.171684048    0.111764828   -0.656287469   -0.658402115   -0.666434155   -0.644152502   0.365767207   0.535745454    9.026614398   0.790831205   0.249075694   0.829127672
    SDi(0.20,1.5)   -0.536249041   1.332943202   -0.259056571   -1.428687263   0.304753100   -1.480497752   0.323879092   -2.740176537    0.128297046   -0.220669108    0.038047615   -0.509581566   -0.512315098   -0.534238255   -0.547529796   0.173529835   0.411869748    11.74528116   0.639393740   0.208177486   0.672430086
    SDi(0.30,1.5)    0.423306706   1.284189822   -0.161129003   -1.724500338   0.163741309   -1.503587674   0.270751302   -2.651152122    0.046935069   -0.217682788    0.150773725   -0.561746007   -0.564077644   -0.584740601   -0.587438557   0.238908602   0.430802682   -14.99983844   0.612644725   0.195150021   0.642975186
    SDi(0.50,1.5)    1.705308399   1.318502336   -0.233003088   -1.296845887   0.234479931   -1.281361908   0.195849339   -2.354696170   -0.041957609   -0.284340263    0.056360870   -0.616749300   -0.621729935   -0.636814273   -0.621799375   0.433329683   0.347095774    9.436414919   0.610786699   0.212500087   0.646696744
    SDi(0.75,1.5)    2.781242117   1.424020040   -0.240408306   -1.214349381   0.213681570   -1.186023142   0.182970413   -2.041406503   -0.053536040   -0.292278832    0.032313084   -0.706497894   -0.706375148   -0.713636562   -0.683312754   0.591093771   0.320684142    8.154475067   0.621543420   0.248224354   0.669276888
    SDi(1.00,1.5)    3.162824284   1.506278722   -0.286892814   -1.136019489   0.176753783   -1.126825557   0.173124105   -1.859489396   -0.104225446   -0.293410614    0.064811405   -0.711250410   -0.717666168   -0.718158606   -0.674059418   0.692966392   0.397984681    7.179848799   0.623233125   0.224539601   0.662448157
    SDi(1.50,1.5)    3.633112081   1.602893237   -0.322787093   -1.034521593   0.119421364   -1.019258438   0.127890046   -1.511337142   -0.020908785   -0.254662507    0.101649772   -0.716758779   -0.727984125   -0.716272768   -0.683389199   0.820851055   0.445987789    6.370211370   0.626061912   0.225730207   0.665513069
    SDi(2.00,1.5)    3.853554858   1.695600902   -0.356593455   -1.000445188   0.090191394   -0.992410042   0.091996214   -1.330998148    0.060010622   -0.299332629    0.070924259   -0.716811612   -0.730918920   -0.713325505   -0.661080818   0.882867426   0.481879411    6.619947623   0.624055441   0.204946944   0.656847351
    SDi(3.00,1.5)    4.166971263   1.902043214   -0.418693027   -1.048516923   0.086735476   -1.038192521   0.076312297   -1.079376917   -0.010366920   -0.348373234    0.029784605   -0.739345398   -0.749326418   -0.727311819   -0.673813225   0.906988986   0.403455515    8.092159636   0.614626070   0.221696054   0.653386827
    SDi(4.00,1.5)    4.365221313   2.074075657   -0.432806344   -0.543085307   0.137631567   -1.165859308   0.094219096   -1.077278316    0.042899473   -0.417233173   -0.103491149   -0.755665532   -0.765037996   -0.734253091   -0.675721181   0.854278086   0.571235841   -14.99983982   0.601100733   0.219238627   0.639834093
    SDi(5.00,1.5)    4.338203907   2.144239937   -0.417486091   -0.460566696   0.159822942   -1.152215986   0.090858912   -1.032637544    0.018191787   -0.570283234   -0.127758107   -0.732559253   -0.739857702   -0.706386227   -0.635737429   0.851708384   0.609916876   -14.99984062   0.603234202   0.239597614   0.649075126
    """),
        "R=2, RotD100": CoeffsTable(sa_damping=5, table="""\
    IMT                        a            b1             b2            c11           c21            c12           c22            c13            c23             f1             f2             s1             s2             s3             s4            d1            d2             c3             φ             τ             σ
    SDi(0.04,2)     -1.209409742   1.260940155   -0.153900084   -1.249184220   0.284319058   -1.273787840   0.257783797   -2.442510716   -0.121321084   -0.247243500    0.194471680   -0.566463059   -0.575547334   -0.605041321   -0.619245346   0.300728814   0.498034610   10.430362220   0.708552569   0.230967521   0.745246763
    SDi(0.06,2)      0.028022440   1.313650895   -0.159414301   -1.102082902   0.247865535   -1.094053398   0.240978071   -1.965122624   -0.127308785   -0.196300615    0.172170848   -0.699044498   -0.703515833   -0.726491463   -0.731340137   0.502533411   0.532714439    8.440297282   0.806442360   0.279323934   0.853446624
    SDi(0.10,2)      0.362570807   1.366390916   -0.116611386   -1.074693766   0.294262100   -1.082761069   0.272409925   -1.875769690   -0.003457658   -0.166586530    0.156189129   -0.714552663   -0.716251065   -0.726731227   -0.699170065   0.575428708   0.541788638    6.640535006   0.845463790   0.301775070   0.897706641
    SDi(0.20,2)      0.436552854   1.336165296   -0.182945956   -1.318549907   0.320764097   -1.311840411   0.287930327   -2.287754106    0.133770757   -0.132421574    0.183084699   -0.629988175   -0.630703401   -0.642848531   -0.630583595   0.354451930   0.421316913    9.334013389   0.691470344   0.232834962   0.729618637
    SDi(0.30,2)      0.956073097   1.343252840   -0.241761254   -1.331853679   0.273384754   -1.338262416   0.262152082   -2.421139754    0.135225418   -0.262133053    0.070741897   -0.608667625   -0.611563593   -0.626700093   -0.613521027   0.341682759   0.401549883   -9.654707733   0.623274485   0.208828783   0.657328338
    SDi(0.50,2)      1.955389523   1.353429668   -0.232765353   -1.274893928   0.229176056   -1.255579143   0.206691715   -2.220408146    0.036321506   -0.275542401    0.053191136   -0.647393016   -0.651691144   -0.662427886   -0.634299704   0.483137648   0.344681961    9.066008656   0.602104961   0.224070398   0.642446828
    SDi(0.75,2)      2.798297498   1.445693981   -0.252126290   -1.207364907   0.203726747   -1.179639175   0.179911501   -1.975038323    0.001105500   -0.291123908    0.025671291   -0.701575460   -0.702497308   -0.706008775   -0.668040016   0.625219576   0.355141808    8.154381791   0.608700409   0.244701522   0.656044986
    SDi(1.00,2)      3.057569913   1.526886059   -0.289427112   -1.145979939   0.172130469   -1.127124648   0.179141909   -1.768554947   -0.054507564   -0.303177782    0.051772266   -0.688047583   -0.696791859   -0.696862676   -0.647466931   0.708238975   0.449972017    7.535522111   0.608382697   0.225974964   0.648994754
    SDi(1.50,2)      3.596869507   1.611674715   -0.316769697   -1.034480583   0.108537266   -1.016557503   0.121636962   -1.479367553    0.017435873   -0.274712878    0.086906965   -0.709344602   -0.720383847   -0.709135876   -0.667345716   0.819722734   0.490139690    6.455076114   0.616694784   0.224083012   0.656144537
    SDi(2.00,2)      3.863009564   1.696376018   -0.343516403   -1.000301803   0.084044283   -0.992824657   0.084524744   -1.343774482    0.090419540   -0.302907196    0.064048233   -0.716975170   -0.729748119   -0.711868391   -0.664933691   0.877981585   0.475337906    6.839400005   0.611421077   0.206008235   0.645193867
    SDi(3.00,2)      4.096376573   1.906453977   -0.415081299   -1.036409200   0.082846951   -1.028604348   0.076878564   -1.113357237    0.081761759   -0.370894300    0.006930362   -0.721757495   -0.732390860   -0.709735834   -0.657330974   0.891368980   0.400746532    8.091244772   0.604487672   0.217488755   0.642422528
    SDi(4.00,2)      4.351540398   2.068172133   -0.419782004   -1.005281973   0.080728082   -1.032988199   0.106440543   -1.140627178    0.040676072   -0.431036560   -0.058545107   -0.748161219   -0.756434691   -0.724186612   -0.666928470   0.834384310   0.485148961    8.092353226   0.591749141   0.221909388   0.631989574
    SDi(5.00,2)      4.245508512   2.165154353   -0.445902383   -0.414834344   0.114573633   -1.135607355   0.083648064   -1.050860644    0.097981496   -0.613303675   -0.194654074   -0.706121658   -0.714657804   -0.683386948   -0.611538134   0.828583862   0.646969331  -14.999838630   0.590695492   0.232162280   0.634681407
    """),
        "R=3, RotD100": CoeffsTable(sa_damping=5, table="""\
    IMT                        a            b1             b2            c11           c21            c12           c22            c13            c23             f1             f2             s1             s2             s3             s4            d1            d2             c3             φ             τ             σ
    SDi(0.04,3)     -1.114207571   1.217421836   -0.168291035   -1.350807411   0.287785364   -1.382437171   0.257121092   -2.798889455   -0.034806285   -0.241510271    0.158409817   -0.507854250   -0.516996006   -0.551608365   -0.575182148   0.192038646   0.413651879   10.283646610   0.689860917   0.210591515   0.721288341
    SDi(0.06,3)      0.445885363   1.249141796   -0.180153562   -1.198520891   0.229598505   -1.190217321   0.206692447   -2.150724687   -0.175260988   -0.237638948    0.162667032   -0.668341565   -0.674895173   -0.705225461   -0.712255473   0.422646104   0.497483106   -8.959845609   0.773000365   0.258531477   0.815087780
    SDi(0.10,3)      1.429631690   1.319195302   -0.113954090   -1.112801812   0.231415631   -1.055154695   0.202153992   -1.697660817   -0.082823682   -0.196473427    0.154316541   -0.778457959   -0.778418528   -0.791202984   -0.771827116   0.671656949   0.556189613    7.788159402   0.868497082   0.323954208   0.926948494
    SDi(0.20,3)      1.539681443   1.417629675   -0.158048489   -1.173768905   0.280010468   -1.181196540   0.303723110   -1.804044136    0.080546527   -0.099554859    0.199569629   -0.742975942   -0.744332859   -0.747653587   -0.707386549   0.537634291   0.452535150    6.620262910   0.774512359   0.293187963   0.828147678
    SDi(0.30,3)      1.794061103   1.401436716   -0.213512853   -1.247232527   0.260695713   -1.244308887   0.281288942   -1.976408893    0.121654923   -0.202041122    0.123535921   -0.707835112   -0.709989121   -0.714345659   -0.677081728   0.521008251   0.424297350    8.060394265   0.685024410   0.249965771   0.729205958
    SDi(0.50,3)      2.180913400   1.423651681   -0.233223089   -1.228915159   0.220562700   -1.209270545   0.220650495   -1.983220012    0.124233142   -0.219838660    0.089721402   -0.664094215   -0.669716684   -0.674896932   -0.632188220   0.578752535   0.433886393    8.276472421   0.623754067   0.246318081   0.670627865
    SDi(0.75,3)      2.799352438   1.491872669   -0.254936583   -1.176032358   0.178412823   -1.156243670   0.188605351   -1.814966131    0.047613782   -0.260071331    0.057144293   -0.688711713   -0.693748311   -0.692788471   -0.642404232   0.676995872   0.392083020    7.704790901   0.613026351   0.243345986   0.659559381
    SDi(1.00,3)      3.070191594   1.549723834   -0.299807990   -1.120196229   0.151890613   -1.108140557   0.149958180   -1.647443909    0.085625135   -0.333970792    0.018619385   -0.676529375   -0.686167696   -0.681742055   -0.632609240   0.732744546   0.523631545    7.252678335   0.608584881   0.221770134   0.647732622
    SDi(1.50,3)      3.643361832   1.636958269   -0.323440628   -1.029224684   0.093266214   -1.011065660   0.108110281   -1.454729533    0.115426546   -0.315125546    0.037495141   -0.709351909   -0.718407120   -0.707445683   -0.654974013   0.816716484   0.416340665    6.599874251   0.610889709   0.220829287   0.649578179
    SDi(2.00,3)      3.861237964   1.712334490   -0.332539212   -0.995892146   0.068490014   -0.996414821   0.079180313   -1.329502268    0.135461097   -0.324203033    0.056347801   -0.714350639   -0.724609381   -0.706171286   -0.666758913   0.856168666   0.457081200    7.013043028   0.605404792   0.213280234   0.641874926
    SDi(3.00,3)      4.101730375   1.958320782   -0.406123234   -1.016723838   0.084111680   -1.011053840   0.097895677   -1.160280349    0.125822703   -0.373806505   -0.018839979   -0.716889599   -0.726387113   -0.701900503   -0.650123055   0.837129877   0.410742191    7.737962075   0.599580790   0.225236187   0.640490799
    SDi(4.00,3)      4.181084731   2.074105488   -0.416786616   -0.980598678   0.077612990   -1.002147829   0.112868807   -1.148381022    0.142719197   -0.485777320   -0.090060945   -0.709581511   -0.717589226   -0.686700618   -0.627182271   0.808776373   0.477734812    7.535187843   0.589560763   0.231388970   0.633342521
    SDi(5.00,3)      4.071747426   2.172288868   -0.447190664   -0.455302800   0.086663975   -1.122549760   0.092235417   -1.044228545    0.195190972   -0.623202345   -0.203149671   -0.672067210   -0.679734386   -0.651532448   -0.581089908   0.795332038   0.672335392  -14.999838890   0.580584365   0.241641848   0.628863250
    """),
        "R=4, RotD100": CoeffsTable(sa_damping=5, table="""\
    IMT                        a            b1             b2            c11           c21            c12           c22            c13            c23             f1             f2             s1             s2             s3             s4            d1            d2             c3             φ             τ             σ
    SDi(0.04,4)     -1.062622628   1.212082438   -0.171441908   -1.420119648   0.269796697   -1.460145005   0.274886515   -2.936638884   -0.003209747   -0.236832633    0.139250908   -0.487628632   -0.495541828   -0.531595086   -0.556491289   0.145240864   0.383149235   11.640828070   0.692392588   0.203150888   0.721580058
    SDi(0.06,4)      0.599424283   1.229112885   -0.148926355   -1.673975803   0.135277660   -1.372328202   0.225433927   -2.191856011   -0.211656824   -0.223795055    0.189269068   -0.661403828   -0.666446946   -0.697295300   -0.700827120   0.376048565   0.545540107  -14.998533040   0.767959505   0.235874017   0.803366886
    SDi(0.10,4)      1.888139613   1.311832092   -0.122410860   -1.112486509   0.215106411   -1.056658222   0.188510159   -1.651872051   -0.150361364   -0.198891371    0.156051026   -0.799530840   -0.798832369   -0.811250694   -0.794768950   0.667066680   0.525183441    7.143082964   0.865399166   0.322017011   0.923369196
    SDi(0.20,4)      2.091007131   1.453553616   -0.133471796   -1.126789618   0.260531544   -1.126738206   0.304759366   -1.577230418    0.033094337   -0.092826891    0.254933173   -0.789856458   -0.792680953   -0.792165427   -0.740111514   0.633333783   0.456451375    5.933273820   0.813844638   0.317479692   0.873576814
    SDi(0.30,4)      2.260693279   1.462335857   -0.209559954   -1.189197656   0.253851696   -1.193109104   0.292330842   -1.732083654    0.131249126   -0.204638149    0.113251799   -0.750518159   -0.754033405   -0.751352657   -0.705982616   0.628060753   0.445898338    6.839305625   0.722848359   0.278283634   0.774565382
    SDi(0.50,4)      2.408765977   1.487976511   -0.239508200   -1.198088338   0.208859064   -1.188412759   0.238405322   -1.800017066    0.168510770   -0.237365679    0.084224205   -0.683021132   -0.688584623   -0.687419583   -0.636262152   0.667949333   0.450997581    7.704889746   0.648311828   0.264671723   0.70025663
    SDi(0.75,4)      2.917912283   1.518299614   -0.267941055   -1.140758712   0.160595273   -1.129143882   0.175844171   -1.707618507    0.105757267   -0.274489261    0.050823550   -0.693102212   -0.699738519   -0.694706589   -0.637632085   0.723191310   0.450566581    7.099842060   0.629062606   0.251528622   0.677485358
    SDi(1.00,4)      3.123849342   1.585713877   -0.310145837   -1.098634351   0.135079922   -1.089516958   0.138298940   -1.539194938    0.199061382   -0.352894941   -0.007687716   -0.674151170   -0.683500980   -0.674050897   -0.629685436   0.748851600   0.540785078    7.142976085   0.617961926   0.224606106   0.65751414
    SDi(1.50,4)      3.592801336   1.663322278   -0.319790093   -1.029557489   0.087010367   -1.007890027   0.098524506   -1.406366757    0.172898705   -0.322598429    0.019727684   -0.695803789   -0.705809868   -0.693950709   -0.642225632   0.797190955   0.445739479    6.599930009   0.615775022   0.221227807   0.654309269
    SDi(2.00,4)      3.903132822   1.751842311   -0.323864097   -0.993031575   0.061161060   -0.989313154   0.079616469   -1.332073370    0.170202410   -0.324154686    0.043367833   -0.719679925   -0.727740242   -0.706195574   -0.653914311   0.816613981   0.471693363    7.012651680   0.610149799   0.219621347   0.648472292
    SDi(3.00,4)      4.085477184   1.991870741   -0.403708963   -0.996945298   0.076802484   -1.003609316   0.105473127   -1.156417182    0.144744383   -0.365777365   -0.020990647   -0.712501263   -0.721265129   -0.692907970   -0.644917090   0.804710131   0.421605282    7.252795375   0.596083956   0.234721929   0.640632864
    SDi(4.00,4)      4.074820530   2.132080582   -0.428538989   -0.976668042   0.079135508   -0.998915491   0.122694678   -1.115121063    0.184665877   -0.519001766   -0.166137595   -0.683791522   -0.690982376   -0.660497520   -0.606641320   0.791035706   0.492442741    7.535117546   0.585368727   0.242053350   0.633440108
    SDi(5.00,4)      4.024458766   2.254437376   -0.459771294   -0.960529450   0.075710334   -0.999979640   0.130899533   -1.072280040    0.176193137   -0.666944645   -0.288125796   -0.650077783   -0.656665795   -0.628752886   -0.564272862   0.777307664   0.622541495    7.448434511   0.571748509   0.255277046   0.626149126
    """),
        "R=6, RotD100": CoeffsTable(sa_damping=5, table="""\
    IMT                        a            b1             b2            c11           c21            c12           c22            c13            c23             f1             f2             s1             s2             s3             s4            d1            d2            c3             φ             τ             σ
    SDi(0.04,6)     -0.956858093   1.231164367   -0.262394810   -1.437291107   0.251295877   -1.509097771   0.278618719   -3.071853524    0.055824040   -0.300635569    0.034265712   -0.460124739   -0.466853496   -0.505738697   -0.531388789   0.085273674   0.401118898  12.059623100   0.699104346   0.198422817   0.726717621
    SDi(0.06,6)      0.667788910   1.187917027   -0.156630646   -1.298900472   0.233240664   -1.275223432   0.176401514   -2.432053371   -0.143491865   -0.239138284    0.187105437   -0.619316624   -0.624483540   -0.657779500   -0.660378264   0.344188713   0.419773751  -9.534322152   0.756905846   0.223364102   0.789175508
    SDi(0.10,6)      2.264751667   1.331828883   -0.121392522   -1.143038456   0.201433068   -1.089655019   0.180728159   -1.664799175   -0.226398759   -0.168256596    0.221533247   -0.806853104   -0.807253049   -0.820564396   -0.801354376   0.659179017   0.474570195   7.617894975   0.848383466   0.303315970   0.900974519
    SDi(0.20,6)      2.900320814   1.511529609   -0.146540442   -1.092176288   0.237133066   -1.070762854   0.289039074   -1.394361687   -0.033633512   -0.127869148    0.225906152   -0.861241722   -0.863531076   -0.855814654   -0.799202343   0.740968874   0.475684969   5.538667752   0.834436182   0.332662407   0.898302855
    SDi(0.30,6)      2.807580070   1.530498865   -0.200342708   -1.139466744   0.229650371   -1.128792206   0.286313187   -1.456206311    0.122729283   -0.158485621    0.155889004   -0.796027812   -0.801175364   -0.790682394   -0.736067428   0.757618491   0.445548508   6.253862851   0.762587295   0.304596628   0.821168977
    SDi(0.50,6)      2.806697408   1.547589138   -0.251839837   -1.134297079   0.183067565   -1.135394068   0.225112950   -1.578546581    0.264572096   -0.258180400    0.056005655   -0.715571203   -0.722071624   -0.712757297   -0.664000410   0.764279525   0.439122457   6.599822016   0.681053965   0.281702398   0.737014752
    SDi(0.75,6)      3.206062450   1.590837295   -0.305298536   -1.114989741   0.128387264   -1.111181882   0.155101936   -1.528983833    0.219391461   -0.365050719   -0.026750099   -0.715278771   -0.721526675   -0.709259764   -0.655006188   0.789777332   0.507684627   7.179973937   0.650403789   0.267494481   0.703262672
    SDi(1.00,6)      3.094884948   1.604063336   -0.297922818   -1.065387147   0.098647312   -1.053866935   0.103067130   -1.362736221    0.333233973   -0.315421456    0.044844673   -0.657518436   -0.669209532   -0.654001755   -0.613395575   0.777763568   0.515950236   6.599879779   0.640533465   0.228572736   0.680094563
    SDi(1.50,6)      3.568603918   1.713199107   -0.302381235   -1.018381669   0.076197921   -1.002409648   0.086025591   -1.335649086    0.241263965   -0.320784524    0.021598521   -0.687692831   -0.698085085   -0.680997689   -0.625213664   0.779280271   0.516026029   6.599919712   0.631986510   0.231340113   0.672997174
    SDi(2.00,6)      3.720817806   1.815999598   -0.314946782   -0.981623859   0.058020067   -0.976375616   0.079691726   -1.323562383    0.217647763   -0.330966912    0.021255781   -0.685410163   -0.693605530   -0.672276898   -0.614721405   0.757843535   0.530135105   6.640862950   0.622519198   0.234106332   0.665083398
    SDi(3.00,6)      3.876822457   2.041579483   -0.393548151   -0.995662330   0.078264562   -1.002684250   0.118470663   -1.146421533    0.206251466   -0.385012934   -0.018162893   -0.679196309   -0.688386265   -0.659334014   -0.612929199   0.760624053   0.460474245   7.156635392   0.592808658   0.244117730   0.641104961
    SDi(4.00,6)      3.795882627   2.144390862   -0.400323556   -0.997359931   0.095202789   -0.999730558   0.135844551   -1.052460806    0.174357633   -0.481562283   -0.068278754   -0.651236841   -0.657408571   -0.627668579   -0.572707598   0.762843120   0.549996307   7.952844123   0.580286767   0.255165290   0.633910133
    SDi(5.00,6)      3.712725281   2.216112748   -0.420853399   -0.988383938   0.085135938   -0.993127103   0.142839033   -1.037146134    0.206070417   -0.595262466   -0.153657654   -0.614595842   -0.620549126   -0.595830220   -0.536629223   0.742789263   0.646521768   8.200021033   0.565963432   0.263362667   0.624239137
    """),
    }
